package com.nkym.wypan.enums.socket;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @ClassName MessageType
 * @Author nkym
 * @Date 2023-11-10 13:28
 * @Version 1.0
 */

public enum MessageTypeEnum {
    /**
     * 认证
     */
    AUTH_ROOM(0),
    /**
     * 聊天
     */
    CHAT(1);

    final Integer type;

    MessageTypeEnum(Integer type) {
        this.type = type;
    }
    private static Map<Integer, MessageTypeEnum> cache;
    static {
        cache = Arrays.stream(MessageTypeEnum.values()).collect(Collectors.toMap(MessageTypeEnum::getType, t->t));
    }
    public static MessageTypeEnum of(Integer type) {
        return cache.get(type);
    }

    public Integer getType() {
        return type;
    }


}
